package Classes.GameViews
{
	import Classes.CustomEvents.CustomEvent;
	import Classes.GameDatas.GD_MapGrid;
	import Classes.GameDatas.GD_Zombie;
	import Classes.GameViews.ViewCartoonTargets.VCT_CommonZombie;
	import Classes.GameViews.ViewDisplayers.MapTargets.MapMoveTargets.MMT_Character;
	import Classes.GameViews.ViewDisplayers.MapTargets.MapMoveTargets.MapNPCs.MN_Zombie;
	import Classes.Interfaces.I_ControlTarget;
	
	import flash.display.Graphics;
	import flash.display.Sprite;
	import flash.events.MouseEvent;
	import flash.geom.Point;

	public class myLLK_zombie extends MN_Zombie
	{
		public var han:uint=0;
		public var lie:uint=0;
		public var type:Number=-1;
		public var myllk:myLLK;
		public var isDie:Boolean=false;
		public var _isSelectllk:Boolean=false;
		public function myLLK_zombie(gd:GD_Zombie,myllk:myLLK)
		{
			super(gd);
			this.myllk	=	myllk;
			//this.addEventListener(CustomEvent.CARTOONPLAYOVER,cartoonOver);
//			this.removeEventListener(CustomEvent.CARTOONPLAYOVER,cartoonOverHandler);
//			super.removeListener();
		}

		/**
		 *覆写对象被点击方法 
		 * @param e
		 * 
		 */		
		override public function beClicked(e:MouseEvent):void
		{
			var theGD:GD_Zombie		= 	this.gameData as GD_Zombie;
			this.myllk.clickZombie(this);
			
		}
		
		/**
		 *更新 
		 * 
		 */		
		override public function update():void
		{
			if(_isSelectllk){
				if(!this.isDie)this.commonZombie.playAction("rightDown","stand");
			}
			else
			if(!this.isDie)this.commonZombie.playAction("leftUp","stand");
			//super.update();
		}
		
		private function cartoonOver(e:CustomEvent):void
		{
			switch(e.msgStr)
			{
				case "die":
					this.over();
					myllk.mapAry2[han][lie]=-1;
					if(this.parent)this.parent.removeChild(this);
					break;
			}
			e.stopPropagation();

		}
		public function over():void
		{
			//this.commonZombie.playAction("up","die");
			this.isDie=true;
			this.myllk.mapAry2[han][lie] = -1;
			if(this.parent){
				this.parent.removeChild(this);
			}
			

		}
		
		public function set isSelectllk(value:Boolean):void
		{
			_isSelectllk = value;
			update();
		}
	}
}